﻿
<Serializable()>
Public Class TokenUsage

    Public Property Definition As TokenDefinition
    Public Property ObjectType As ObjectType
    Public Property SubType As ObjectSubType
    Public Property Description As String
    Public Property Arguments As List(Of ArgumentDefinition)
    Public Property Flags As UsageFlags
    Public Property ArgsType As ArgsType
    Public Property ArgsTypeData As String
    Public Property Scope As CreatureTokenScope = CreatureTokenScope.None

    Public Sub New()
        Arguments = New List(Of ArgumentDefinition)
        ObjectType = ObjectType.ALL
        SubType = ObjectSubType.ALL
        Description = ""
        ArgsType = ArgsType.Standard
    End Sub

    Public Sub New(objectType As ObjectType, SubType As ObjectSubType)
        Me.New()
        Me.ObjectType = objectType
        Me.SubType = SubType
    End Sub

    Public Sub New(obj As RawObject)
        Me.New()
        Me.ObjectType = obj.ObjectType
        Me.SubType = obj.ObjectSubType
    End Sub

    Public Function GetArgumentHtmlString() As String
        Dim ret As String = "<i>"
        ret &= String.Join("</i><b> : </b><i>", (From arg As ArgumentDefinition In Arguments Select arg.Name).ToArray)
        ret &= "</i>"
        Return ret
    End Function

    Public Overrides Function ToString() As String
        Return String.Format("{0}:{1}", ObjectType, SubType)
    End Function

    Public Function GetArgsHandler() As IArgsTypeHandler
        Return ArgumentManager.instance.GetArgsTypeHandler(Me.ArgsType)
    End Function

End Class
